package com.qf.java2107.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.java2107.mapper.PassengerMapper;
import com.qf.java2107.mapper.PassportsMapper;
import com.qf.java2107.pojo.Passenger;
import com.qf.java2107.pojo.Passports;
import com.qf.java2107.service.PassengerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author YB
 * @date 2022/01/07
 * @VERSION V1.0
 **/
@Service
@Transactional
public class PassengerServiceImpl implements PassengerService {

    @Autowired
    private PassengerMapper passengerMapper;

    @Autowired
    private PassportsMapper passportsMapper;

    @Override
    public List<Passenger> findAll() {

        return passengerMapper.selectByExample(null);
    }

    @Override
    public PageInfo<Passenger> findPage(Integer pageNum,Integer pageSize) {

        PageHelper.startPage(pageNum,pageSize);

        List<Passenger> passengers = passengerMapper.selectByExample(null);

        return new PageInfo<>(passengers);
    }

    @Override
    public Passports findById(Integer id) {
        return passportsMapper.selectByPrimaryKey(id);
    }


}
